home *** CD-ROM | disk | FTP | other *** search
- REM ZIPIT.BAS
- DECLARE SUB GetInputFile ()
- DECLARE SUB GetOutputFile ()
- DECLARE SUB Pause ()
- DECLARE SUB TestFileName ()
- DECLARE SUB ZipIt ()
- COMMON SHARED InputFile$, OutputFile$, Chooser$, Sw1$
- CONST ZipSpec$ = "C:\UTILS\ZIP\PKZIP", ZipDir$ = "C:\ZIPFILES\"
-
- CLS : LOCATE 6, 10: PRINT "Select one of the following: "
- LOCATE 8, 20: PRINT "A - Files in one directory only"
- LOCATE 10, 20: PRINT "B - Files in directory and all its subdirectories"
- LOCATE 12, 20: PRINT "C - All files on current drive modified today"
- DO WHILE Chooser$ = ""
- Chooser$ = INKEY$
- IF UCASE$(Chooser$) < "A" OR UCASE$(Chooser$) > "C" THEN : Chooser$ = ""
- LOOP
-
- SELECT CASE Chooser$
- CASE "A", "a"
- CLS : Sw1$ = " "
- GetInputFile
- GetOutputFile
- ZipIt
- CASE "B", "b"
- CLS : Sw1$ = "-p -r "
- GetInputFile
- GetOutputFile
- ZipIt
- CASE "C", "c"
- CLS : Sw1$ = "-t -p -r "
- InputFile$ = "\*.*"
- GetOutputFile
- ZipIt
- END SELECT
-
- CLS : SYSTEM
-
- SUB GetInputFile
- CLS : LOCATE 10, 10
- INPUT "Enter name of file(s) to Zip (default is *.*): ", InputFile$
- IF InputFile$ = "" THEN InputFile$ = "*.*"
- END SUB
-
- SUB GetOutputFile
- OutputFile$ = "": CLS : LOCATE 10, 10
- INPUT "Enter name of destination file (no extension): ", OutputFile$
- TestFileName
- END SUB
-
- SUB Pause
- PRINT " Press any key to continue..."
- DO: LOOP UNTIL INKEY$ <> ""
- END SUB
-
- SUB TestFileName
- IF INSTR(OutputFile$, ".") <> 0 THEN
- CLS : PRINT "No extensions allowed! Try again. ": Pause
- LOCATE 10, 10: PRINT SPACE$(70)
- GetOutputFile
- ELSE
- IF LEN(OutputFile$) > 8 OR LEN(OutputFile$) = 0 THEN
- CLS : PRINT "Filename must be 1-8 characters! Try again.": Pause
- LOCATE 10, 10: PRINT SPACE$(70)
- GetOutputFile
- END IF
- END IF
- END SUB
-
- SUB ZipIt
- OutputFile$ = ZipDir$ + OutputFile$ + ".ZIP" + " "
- CLS : PRINT "The current drive/directory is "; : SHELL "CD"
- SELECT CASE Chooser$
- CASE "A", "a"
- PRINT "You have chosen files matching the spec " + InputFile$
- PRINT " in the current or specified directory."
- CASE "B", "b"
- PRINT "You have chosen files matching the spec " + InputFile$
- PRINT " in the current or specified directory"
- PRINT " and all its subdirectories."
- CASE "C", "c"
- PRINT "You have chosen to back up all files on the"
- PRINT " current drive that were created or modified today."
- END SELECT
- PRINT : PRINT "Destination file is " + OutputFile$
- PRINT "Zip selected files (y/n)? "
- DO WHILE OKToZip$ = ""
- OKToZip$ = INKEY$
- IF UCASE$(OKToZip$) <> "Y" AND UCASE$(OKToZip$) <> "N" THEN
- OKToZip$ = ""
- END IF
- LOOP
- SELECT CASE OKToZip$
- CASE "Y", "y"
- CLS : SHELL ZipSpec$ + " " + Sw1$ + OutputFile$ + InputFile$
- CASE ELSE: CLS : SYSTEM
- END SELECT
- END SUB
-